# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=mingetty
pkgver=1.08
pkgrel=7
pkgdesc="A compact getty program for virtual consoles only"
url="https://sourceforge.net/projects/mingetty/"
arch="all"
license="GPL-2.0-or-later"
# We do link libutmps and libskarnet (its dependency) statically to avoid
# potential breakages on upgrades. Skarnet strongly prefers static linking for
# these libs. Moreover, libskarnet is quite big and only a tiny part is used
# in libutmps, so it results in a smaller installation size.
makedepends="skalibs-static utmps-dev utmps-static"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/mingetty/mingetty-$pkgver.tar.gz
	0001-check_chroot_chdir_nice.patch
	0002-openlog_authpriv.patch
	0003-limit_tty_length.patch
	0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
	0005-clear-scroll-back-buffer-on-clear-screen.patch
	0006-use-utmpx-instead-of-legacy-utmp.patch
	fix-makefile.patch
	"
options="!check"  # no tests provided

build() {
	make \
		CFLAGS="$CFLAGS $(pkg-config --cflags --static utmps)" \
		LDLIBS="$(pkg-config --libs --static utmps)"
}

package() {
	make install DESTDIR="$pkgdir" SBINDIR="/usr/sbin"
}

sha512sums="
d2c050a412af81d4635cbaa5610dfa2cf2addce0d3116fa53f73eb15cd6b53d476165a0509ae630a151de07a5bdc82cba1b5da0ab78d0313b200adece3c8872b  mingetty-1.08.tar.gz
5c893b3d5d3f16d1e5bc326e135450e354f522e89525c4282532e10672565ec4b013a7e48930b8cd5f9cb13d943007c347332b230b170a5e9a207cf5412c31ab  0001-check_chroot_chdir_nice.patch
6463c3f1b6fdcedd026c876dd1e1df12f85d2778ccc76f713841888016d7dfa5abb57b37d5fe5e3b9c70f51a22e10166588cc91fa618141468c5d6b8608cf537  0002-openlog_authpriv.patch
79cc3cffe26c9e12a4999de4d4573a436ce485e5f86ed540ed8856b1e4f3ebd78d1f8f68d936c301ba026b6f2545d08be70eb0f68aeb37405814e105c57be7c4  0003-limit_tty_length.patch
1fbfc5042f012bb33976b8c5805c5dec1c6da8580b89e79126dc11cf5afbe02997073adf241d5c8f7ededfe4d84794d35149b1274b168478d93a10cf3b146974  0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
76e984cc2f3fb638e0d7e1da1b3de6f3f5a05d6061631799c8697182fdf13e57ee0db52de0823c3acc75fc0e432ea9f569977a06f5cdddeb8a781ec463b62531  0005-clear-scroll-back-buffer-on-clear-screen.patch
a885f0010f4609c7783e31c8702e218d88b6d8e3b9f43d801c6ddc42fcbda63c9648922e504dd0f8bf5da3d2db374b0dbf1d01a1f3b551d178ead29d7bf25192  0006-use-utmpx-instead-of-legacy-utmp.patch
d7fed102ff1f117f763dcaa78ee808220fcdc4799afe33fa20ef920d691280c76f778a1af18db933b4768b6e4a005ba1cdec00d700815f223896685b239eb152  fix-makefile.patch
"
